package com.gwt.boot.exception;


import com.gwt.cloud.constant.ApiResultEnum;

public class BusinessException extends RuntimeException{
    private static final long serialVersionUID = 1L;
    private final Integer status;
    private final String message;

    public BusinessException(Integer status, String message) {
        super(message);
        this.status = status;
        this.message = message;
    }

    public BusinessException(String message) {
        super(message);
        this.status = ApiResultEnum.FAIL.getStatus();
        this.message = message;
    }

    public Integer getStatus() {
        return status;
    }

    @Override
    public String getMessage() {
        return message;
    }

    public static BusinessException error(Integer status, String message){
        return new BusinessException(status, message);
    }
    public static BusinessException error(String message){
        return new BusinessException(message);
    }
}
